<template>
	<view class="">
		<uni-list v-if="list.length > 0">
			<uni-list-item v-for="(el,index) in list" :key="index" :title="el.video_name" :note="el.created_at"
				:rightText="el.money"></uni-list-item>
		</uni-list>
		<view v-else class="none">
			暂无记录
		</view>
	</view>
</template>

<script>
	import {
		getWatchPayRecord
	} from '../../module/index.js'
	export default {
		data() {
			return {
				list: [],
				params: {
					page: 1,
					limit: 15,
					total_page: 0
				},
			}
		},
		onShow() {
			this.getWatchPayRecord()
		},
		onReachBottom() {
			let {
				total_page,
				page
			} = this.params
			if (page > total_page > 0) {
				return;
			}
			this.getWatchPayRecord()
		},
		methods: {
			getWatchPayRecord() {
				getWatchPayRecord(this.params).then((res) => {
					if (res.code === 200) {
						this.list.push(...res.data.data);
						this.params.page++
						this.params.total_page = res.data.total_page
					} else {
						uni.showToast({
							title: res.message,
							icon: "none"
						})
					}
				}).catch(err => {
					console.log(err)
				})
			}
		}
	}
</script>

<style scoped>
.none{
		margin: auto;
		text-align: center;
		color: #999;
		margin-top: 50rpx;
	}
</style>